Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support jsonschema >= 3.0.0 #1050

Merged
merged 2 commits into from
Oct 18, 2019
Merged

Support jsonschema >= 3.0.0 #1050

merged 2 commits into from
Oct 18, 2019

Conversation

neverpanic
Copy link
Contributor

Fixes #983.

Other projects have started using jsonschema >= 3.0.0, and modern python packaging tools such as poetry now fail to install projects using both connexion and a different dependency if they depend on different versions of jsonschema.

Allow jsonschema versions >= 3.0.0 to avoid this problem. Add a version branch to avoid a warning that would otherwise be thrown by jsonschema when using the deprecated types parameter of the jsonschema.IValidator constructor.

Changes proposed in this pull request:

  • setup.py: Support jsonschema >= 3.0.0
  • Avoid warning when using jsonschema >= 3.0

Clemens Lang added 2 commits October 8, 2019 14:39
Other projects have started using jsonschema >= 3.0.0, and modern python
packaging tools such as poetry now fail to install projects using both
connexion and a different dependency if they depend on different
versions of jsonschema.

Allow jsonschema versions >= 3.0.0 to avoid this problem.

See: python-poetry/poetry#697
jsonschema 3.0.0 changed the API to deprecate the types parameter of the
jsonschema.IValidator constructor and now raises a warning when using
it.

Avoid the warning by checking the jsonschema version and switching to
the new way to implement this when it is >= 3.0. Note that while
jsonschema 2.x did have jsonschema.validators.extend, it did not support
the type_checker argument, so the same code cannot be used with
jsonschema 2.x.
@neverpanic
Copy link
Contributor Author

ping?

@hjacobs
Copy link
Contributor

hjacobs commented Oct 17, 2019

I'm not sure, but I remember in other PRs that there was potentially an issue with a new jsonschema version -- I wonder what prevented us from updating earlier?

@neverpanic
Copy link
Contributor Author

@hjacobs I think the other attempts to update jsonschema also talked about getting new validation functionality (e.g. against the newer draft versions) into connexion, which isn't as simple. This PR doesn't do that, it just updates the dependency but keeps all validation behavior the same.

@hjacobs
Copy link
Contributor

hjacobs commented Oct 18, 2019

👍

@hjacobs hjacobs merged commit 7a1ce8d into spec-first:master Oct 18, 2019
@neverpanic neverpanic deleted the jsonschema-3 branch October 18, 2019 12:57
@vssteve
Copy link

vssteve commented Oct 18, 2019

FYI, I found the change to allow jsonschema>=3.0.0 prevented connexion 2.4.0 from running for me because I'm using Python 2.7 and this happened because jsonschema 3.x eventually brings in the more_itertools package which now requires on Python 3.5 or later. In my case the dependency order was connexion 2.4.0->jsonschema 3.1.1 ->zipp 0.6.0->more_itertools 7.2.0.

@neverpanic
Copy link
Contributor Author

@vssteve Nothing in this PR requires jsonschema > 3. You can just manually downgrade jsonschema to a version < 3 for the remaining two months that python 2.7 is still supported.

@daisieh
Copy link
Contributor

daisieh commented Mar 9, 2021

Is this update included in any releases of connexion? It looks like it's not included in the 2.7 release on PyPI...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support jsonschema3
4 participants